package data_structure;

import java.util.ArrayList;
import java.util.List;

public class leetcode_0232 {

}
class MyQueue {
    List<Integer> list1;
    List<Integer> list2;
    int current1;
    int len1;
    public MyQueue() {
        list1=new ArrayList<>();
        list2=new ArrayList<>();
        current1=0;
        len1=0;
    }

    public void push(int x) {
        list1.add(x);
        len1++;
        list2.clear();
        for(int i=len1-1+current1;i>=current1;--i){
            list2.add(list1.get(i));
        }
    }

    public int pop() {
        int top=list2.remove(list2.size()-1);
        current1++;
        len1--;
        return top;
    }

    public int peek() {
        return list2.get(list2.size()-1);
    }

    public boolean empty() {
        if(len1==0) return true;
        return false;
    }
}